refactor: remove lodash dependency in favor of native JavaScript#972
Open
Vikash9546 wants to merge 1 commit into
Open
refactor: remove lodash dependency in favor of native JavaScript#972Vikash9546 wants to merge 1 commit into
Vikash9546 wants to merge 1 commit into
Conversation
- Replaced `lodash.pick` with `Array.prototype.reduce` in CLI options - Replaced deep object merging logic with native `Object.assign` in server/plugins - Dropped `lodash` from production dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary of the change
This PR removes the
lodashdependency from thehoodiepackage and replaces its specific usage with native equivalent operations (such asObject.assignandArray.prototype.reduce).Why the change is needed
Modern Node.js versions have comprehensive support for common data manipulations that were historically handled by utility libraries. Removing
lodash:Implementation details
cli/options.js:pick()requirement was dropped in favor of extracting the defaults withObject.keys()and filtering viaArray.prototype.reduce().server/index.js: The_.cloneDeep()and_.defaultsDeep()calls merged configurations (plugins,app,paths). Because we only override predefined 1-depth nested fields here, nativeObject.assignprovides exactly the same deep-merging behavior we desired without tracking heavylodashproperties.test/unit/server/public-test.js:_.mergeimplementation changed to a nativeObject.assignalternative.How it was tested
The native changes duplicate the exact execution states previously achieved using
lodash. I ran the standard unit and integration test suites vianpm testand formatting vianpm run pretestwithout observing any functional regressions in CLI parameter parsing or Server initialization processes.Any breaking changes
No. This change operates under identical input/output contracts to consumers and represents purely an under-the-hood modernization task.